﻿using System.Runtime.Serialization;

namespace Cesave.DistributedServices.Core.ErrorHandlers
{
    /// <summary>
    /// Default ServiceError.
    /// </summary>
    [DataContract(Name = "ServiceError", Namespace = "Microsoft.Samples.DistributedServices.Core")]
    public class ServiceError
    {
        /// <summary>
        /// Error message that flow to client services
        /// </summary>
        [DataMember(Name = "ErrorMessage")]
        public string ErrorMessage
        {
            get;
            set;
        }

        /// <summary>
        /// ServiceError factory.
        /// </summary>
        /// <param name="errorMessage">
        /// Error message that flows to client services.
        /// </param>
        /// <returns></returns>
        public static ServiceError Factory(string errorMessage)
        {
            return new ServiceError()
                       {
                           ErrorMessage = errorMessage,
                       };
        }

    }
}
